﻿#include "EditorFPSStatusView.h"
#include "EditorFPSStatusViewModel.h"

#include "Widgets/TextWidget.h"
#include "Widgets/Positioners/HorizontalPositionerWidget.h"

void REditorFPSStatusView::BindViewModel(TSharedObjectPtr<REditorStatusItemViewModel> InViewModel)
{
    Super::BindViewModel(InViewModel);
    FPSViewModel=InViewModel;
}

void REditorFPSStatusView::FillWidgets(TSharedObjectPtr<RHorizontalPositionerWidget> InLeftPart, TSharedObjectPtr<RHorizontalPositionerWidget> InRightPart)
{
    Super::FillWidgets(InLeftPart, InRightPart);

    //创建一个文本控件
    TSharedObjectPtr<RTextWidget> TextWidget = NewWidget<RTextWidget>(InLeftPart);
    TextWidget->Text=[this]()
    {
        return FPSViewModel->GetFPS();
    };
    TextWidget->Width=250;
}
